package com.example.hy2110szyx.service.impl;


import com.example.hy2110szyx.entity.*;

import com.example.hy2110szyx.repository.ReservedMapper;
import com.example.hy2110szyx.service.ReservedService;
import com.example.hy2110szyx.vo.PageVo;
import com.example.hy2110szyx.vo.ReservedVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ReservedServiceImpl implements ReservedService {

    @Autowired
    private ReservedMapper reservedMapper;

    @Override
    public Page<ReservedTicket> queryAllReservedForPage(PageVo<ReservedVo> pageVo) {
        Page<ReservedTicket> page = PageHelper.startPage(pageVo.getStart(), pageVo.getMax(),
                pageVo.getOrderBy() + " " + pageVo.getOrder());
        reservedMapper.queryAllConn(pageVo.getCondition());
        return page;
    }

    @Override
    public List<ReservedVo> queryAllConn(ReservedVo reservedTicket) {
        return reservedMapper.queryAllConn(reservedTicket);
    }

  /*  @Override
    public ReservedTicket queryByIdentity(String identity) {
        return reservedMapper.queryByIdentity(identity);
    }*/

    @Override
    public void insertOne(ReservedTicket reserved) {
        reservedMapper.insertOne(reserved);

    }

    @Override
    public void insertOneRoute(Route route) {
        reservedMapper.insertOneRoute(route);
    }

    @Override
    public void insertOneDistribution(Distribution distribution) {
        reservedMapper.insertOneDistribution(distribution);

    }

    @Override
    public void insertOneCustomer(Customer customer) {
        reservedMapper.insertOneCustomer(customer);

    }

    @Override
    public void insertOneFlightInfo(FlightInfo flightInfo) {
        reservedMapper.insertOneFlightInfo(flightInfo);

    }

    @Override
    public void deleteSomeById(Integer id) {
        reservedMapper.deleteSomeById(id);
    }

    @Override
    public void delOneFlightInfo(String fno) {
        reservedMapper.delOneFlightInfo(fno);

    }

    @Override
    public void delOneRoute(String rno) {
        reservedMapper.delOneRoute(rno);
    }

    @Override
    public void delOneDistribution(String fno) {
        reservedMapper.delOneDistribution(fno);
    }

    @Override
    public void delOneCustomer(String identity) {
        reservedMapper.delOneCustomer(identity);

    }

}
